How many items target currently holds - 0 for an empty stack, up to target's own declared capacity once it is full.
stack_length(target) -> int| Name | Type |
|---|---|
target | stack |
int
How many items target currently holds - 0 for an empty stack, up to target's own declared capacity (/// @capacity, or 8 if untagged) once it is full.
This is how many items are IN target right now, not its capacity - a common use is checking whether there is still room before pushing, or showing a depth counter on the HUD.
/// @type {stack<int>}
var history = [1, 2, 3];
var depth = stack_length(history); // 3



Just the vector's size() - O(1), identical to list_length.